import { ConfigProvider, theme } from 'antd'
import MainRoutes from '@/routes';
import './App.css'
import { useThemeStore } from '@/store'
import { th } from '@/theme'

function App() {
  const { mode } = useThemeStore()
  const isDarkMode = mode === 'dark'

  return <ConfigProvider theme={{
    components: {
      Layout: {
        siderBg: th('siderBg'),
        triggerBg: th('triggerBg'),
      }
    },
    cssVar: true,
    algorithm: isDarkMode ? theme.darkAlgorithm : theme.defaultAlgorithm
  }}>
    <MainRoutes />
  </ConfigProvider>
}

export default App
